﻿using System.Management.Automation;

namespace Nivot.PowerShell.WindowsMobile.Commands
{
    [Cmdlet(VerbsCommon.Get, "WMDeviceInfo")]
    public class GetWMDeviceInfoCommand : WMCommandBase
    {
        protected override void EndProcessing()
        {
            var info = new PSObject();
            info.Properties.Add(new PSNoteProperty("Name", Device.Name));
            info.Properties.Add(new PSNoteProperty("OSVersion", Device.OSVersion));
            info.Properties.Add(new PSNoteProperty("Platform", Device.Platform));
            info.Properties.Add(new PSNoteProperty("ConnectionType", Device.ConnectionType));
            info.Properties.Add(new PSNoteProperty("IPAddress", Device.IPAddress));
            info.Properties.Add(new PSNoteProperty("BatteryLifePercent", Device.PowerStatus.BatteryLifePercent + "%"));
            info.TypeNames[0] = "WMDeviceInfo";
            WriteObject(info);
        }
    }
}